Scope the Montana 2021 income tax rebate to its eligibility year - #8970
Scope the Montana 2021 income tax rebate to its eligibility year#8970PavelMakarchuk wants to merge 4 commits into
Conversation
The variable returned the flat filing-status amount (1,250/2,500) for every MT filer in every year >= 2021, ignoring the statutory cap (lesser of the amount or the taxpayer's income tax liability) and the rebate's 2021-only scope. Montana income tax results are unchanged - the credit application already floored the applied amount - but the variable's reported value was wrong for low-liability filers and for 2022+ (it produced phantom amounts in the TAXSIM-comparison srebate work). Cap at the smaller of the joint and separate-column pre-credit bases (the filing election itself is post-credit and would create a computation cycle), zero-scope the amounts from 2022, and replace the period-2023 no-income unit tests that encoded the uncapped values. Fixes #8958. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #8970 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 1 1
Lines 35 16 -19
Branches 2 0 -2
=========================================
- Hits 35 16 -19
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Review: cap the Montana 2021 income tax rebate at liabilityVerified the parameter values and cap logic against the enacted statute and reproduced the behavior on the PR branch. Verdict: approve. The change is correct, well-tested, and provably tax-neutral, with two minor accuracy notes and one nit. Verified
Minor: the cap base is line 18, but the statute specifies line 20The statute caps at line 20 of the 2021 Form 2, which is "Tax after nonrefundable credits" (line 18 − line 19). This PR caps at This has no effect on Minor: citation precisionThe "lesser of ... tax liability" cap is subsection (2)(a); (2)(b) is the flat filing-status amount. The PR title, changelog, and code comment attribute the cap to "(2)(b)"; more precisely, the "lesser of" is in the chapeau of (2), with (a) = liability and (b) = amount. The Nit
Out of scope (pre-existing, not introduced here)For low-liability couples that elect separate filing, MT income tax can go slightly negative (for example −33.81 for the $20k couple) because the tax-unit-level rebate is projected onto persons in the separate-column allocation ( |
|
Heads-up from taxsim triage (PolicyEngine/policyengine-taxsim#1078): this cap is one of three legs on that record, but it does not fix the per-person projection filed as #9012 — |
|
@MaxGhenis your review above concludes "Verdict: approve" but was posted as a comment, so the PR still shows as awaiting review — would you mind submitting it as a formal approval when you get a chance? Thanks! |
|
Heads-up: #9019 merged (along with #9018), which changes the ground under this PR. That interacts with this PR's two components differently: The liability cap no longer belongs in the formula. Two reasons, one old and one new:
The 2022 zeroing in Suggested rework:
Auto-merge is disabled on this PR until the rework lands, since a formal approval of the current head would merge a stale TaxUnit formula over #9019. |
…d liability cap PRs #9018/#9019 landed after this branch was opened and moved mt_income_tax_rebate to a Person-entity variable that splits the per-return cap across each spouse's column. That is the correct architecture, so this branch no longer carries its own TaxUnit formula: - Take main's Person-entity formula unchanged. Porting the liability cap into it would under-pay a one-earner couple electing the joint column, which the statute and the DOR rebate report grant min($2,500, joint line 20). - Document instead, on that formula, that MCA 15-30-2191(2)'s lesser-of rule is already enforced by the ordered non-refundable credit application, which floors each path at zero. Verified: a $20k joint couple has $252.40 of pre-credit liability and lands at exactly $0 before refundable credits. - Keep amount.yaml's 2022 zeroing. This is the behavioural fix: without it the 2021 amounts backdate forward and every Montana filer gets a phantom rebate. - Rework the tests onto period 2021, add 2022/2023 year-scoping guards that assert mt_income_tax end to end, and re-express the low-liability case as the credit floor in action rather than a capped rebate value. - Rename the changelog fragment to match the branch and rescope its wording. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
Reworked in 0a6a95f along the lines @hua7450 laid out on 2026-07-17. Re-requesting review from @hua7450 and @MaxGhenis. What changed PRs #9018/#9019 landed after this branch was opened and moved
Verification on the merged head: MT rebate tests 8 passed; full Montana suite 558 passed; partner contract suite 630 passed (no partner test references MT, so there is no partner-facing impact); Still open, unchanged by this PR: the per-person projection tracked in #9012 is resolved on main by #9019, so the note I left on 2026-07-13 about a joint couple netting 2 × $2,500 no longer applies here. The branch was 908 commits behind and is now merged up to date. |
|
Heads up @PavelMakarchuk — this has a sibling in the same subsystem: the Montana property tax rebate ( Filed as #9347, PR up at #9348. No file overlap with this one (I don't touch |
Program Review — PR #8970: Montana 2021 income tax rebate (year-scoping + liability cap)PR head: OverviewThe PR has two advertised purposes:
The delivered half is well-sourced and genuinely guarded by tests. The un-delivered half is Source Documents
Branch StatusThe branch is 32 commits behind CriticalC1 — Cited statute URL no longer corroborates the parameter valuesFiles: Both the parameter and the variable cite the same href, which now resolves (verified live) to Fix (choose one value-containing source): cite HB 192 (2023 Regular Session, Ch. 44, C2 — Subsection citation is impreciseFile: The bare "(b)" drops the (1) and the (i)/(ii) that actually pin the dollar figures: the amounts Recommended title: "Montana Code Annotated (2023), 15-30-2191(1)(b)(i)–(ii) — rebate amounts Verification caveat: the live section is confirmed "Terminated" by direct fetch, but the full Should AddressS1 — PR body claims a variable-level cap the code does not implement (central finding)File: The per_person_amount = where(
filing_status == statuses.JOINT,
p.amount["SEPARATE"], # $1,250 per spouse for a JOINT return
p.amount[filing_status],
)
return head_or_spouse * per_person_amountConsequences:
The added Options (either resolves it): (1) correct the PR body to state the cap is emergent from S2 — Liability-cap test coverage is partialFile: Both sides of the cap are present (above-cap full amount in cases 1–2; below-cap partial
Note: the year-scoping is genuinely guarded — cases 5 (2022) and 6 (2023) assert SuggestionsG1 — Trailing whitespace
G2 — SURVIVING_SPOUSE = $2,500 is inferred; add a clarifying commentThe statute and DOR report do not name a surviving-spouse / qualifying-widow(er) status. G3 — Reconcile the 2022 test comment's "996.00" counterfactualThe 2022 case comment says "without the 2022 zeroing the leaked $1,250 would cut this to G4 — Point the variable comment at its guarding test
Source / Value Audit summaryAll amounts match the statute — no mismatches. No value differs from the statutory maxima by
Validation Summary
Review Severity: REQUEST_CHANGESTwo CRITICAL reference findings (dead-for-purpose statute link; imprecise subsection cite) are Next StepsRun
🤖 Generated with Claude Code /review-program |
…t the tax The earlier comment claimed the leaked $1,250 would cut 2022 Montana tax from $2,246 to $996. That is wrong, and verified so by counterfactual: credits/non_refundable.yaml already drops mt_income_tax_rebate from the list at 2022-01-01, so removing the amount.yaml sunset leaves mt_non_refundable_credits at 0 and mt_income_tax at 2,246 unchanged - only mt_income_tax_rebate itself moves, 0 -> 1,250. The discriminating assertion is therefore the rebate variable alone; the tax and credit-aggregate pins are unchanged controls, and the changelog now scopes the fix to the reported value that mis-feeds consumers such as the TAXSIM srebate comparison. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
Correction to my previous comment — one claim in it was wrong, pushed as dd53545. I wrote that the 2022 guard was discriminating because "without the zeroing the leaked $1,250 would cut this filer's tax from $2,246.00 to $996.00." That is not true. I verified it by counterfactual — stripping the
What this changes. The fix is still correct and worth landing, but its scope is narrower than I described, and it is the scope @PavelMakarchuk originally stated in the PR description: the defect is the variable's reported value, which mis-feeds consumers of it — the TAXSIM Applied: the misleading test comment is replaced with the accurate one (the rebate variable is the discriminating assertion, 0 vs 1,250; Everything else in my previous comment stands — in particular the verified $20k-couple decomposition ($252.40 pre-credit → $0.00 before refundable credits) showing the ordered credit application already enforces MCA 15-30-2191(2)'s lesser-of rule, which is why the liability cap is correctly dropped. Heads-up @DTrim99: your #9348 edits the same |
Summary
mt_income_tax_rebatereturned the flat filing-status amount ($1,250/$2,500) for every MT filer in every year ≥ 2021, ignoring both the statutory liability cap — MCA 15-30-2191(2)(b): the rebate is the lesser of the amount or the taxpayer's income tax liability — and the rebate's 2021-only scope.Montana
state_income_taxresults are unchanged (verified): the non-refundable credit application already floored the applied amount, and the credits list already restricts application to 2021. The defect was the variable's reported value — wrong for low-liability filers (e.g. a $20k joint couple: reported $2,500, statutory rebate $252.40) and nonzero in 2022+ — which mis-feeds any consumer of the variable (it produced phantom amounts in the TAXSIM-comparisonsrebatework, PolicyEngine/policyengine-taxsim#1070/#1068).Changes
mt_files_separatelyelection is post-credit and would create a computation cycle; the smaller base never exceeds the elected one).rebate/amount.yamlzero-scoped from 2022-01-01.Testing
Full Montana baseline suite: 536 passed, 0 failed. The TAXSIM-parity integration tests are unaffected (they input-override the rebate).
Fixes #8958.
🤖 Generated with Claude Code